package cn.demoncat.test.neo.dao;

import cn.demoncat.test.neo.node.RUserRelation;
import cn.demoncat.test.neo.node.RUserResult;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;

import java.util.List;

// DAO
public interface RUserRelationRepository extends Neo4jRepository<RUserRelation, Long> {

    /**
     * Cypher查询
     *
     * @Query Cypher语法查询
     * @Param 指定参数
     *
     * @return @QueryResult映射类
     */
    @Query("MATCH [r:USER_FOOD] RETURN r.name,r.user.id as userId,r.food.id as foodId")
    List<RUserResult> findRelation();

}
